<?php

// +----------------------------------------------------------------------
// | STJY
// +----------------------------------------------------------------------
// | Copyright (c) 2012-2015 http://www.stjy360.com, All rights reserved.
// +----------------------------------------------------------------------
// | Author: STJY <>
// +----------------------------------------------------------------------

namespace Api\Controller;



use Common\Controller\ShuipFCMS;

class AreaController extends ShuipFCMS {

    public function getRegion() {
        $Region=M("Linkage");
        $map['parentid']=intval($_REQUEST["pid"]);
        $map['keyid']=intval($_REQUEST["keyid"]);
        $list=$Region->where($map)->select();
        echo json_encode($list);
    }

    public function index()
    {
        $area_title = I('get.area_title', '', 'stripslashes');
        $area_extend = I('get.area_extend', '', 'stripslashes');
        $areaid = I('get.areaid',0,'intval');
        $area_deep = I('get.area_deep',0,'intval');
        $area_id= I('get.area_id',1,'intval');
        echo get_area_select($area_title, $areaid, $area_extend, $area_deep, $area_id);
    }
    public function  getAreaNamebyID(){
        $id= I('post.areaID');
        $linkage = M('linkage');
        $areaname = $linkage->where(['linkageid'=>$id])->field('name')->find();
        echo  $areaname['name']; exit;
    }
}
